<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">

    <title>修改项目</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">


    <link rel="stylesheet" href="<%=basePath%>css/xiugai.css">
    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/bootstrap-select.js">
    </script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>css/bootstrap-select.css">
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script>
        function updateById() {
            var id = document.getElementById("cid").value;
            var groups = document.getElementById("groups").value;
            var progess = document.getElementById("progess").value;
            var type = document.getElementById("type").value;
            var name = document.getElementById("cname").value;
            var stime = document.getElementById("stime").value;
            var etime = document.getElementById("etime").value;
            var detail = document.getElementById("detail").value;
            var leader = document.getElementById("leader").value;
            var checker = document.getElementById("checker").value;
            var kehuer = document.getElementById("kehuer").value;
            //var others2 = document.getElementById("others2").value;
            var remarks = document.getElementById("remarks").value;
            message = '${pro.progess}' + '更改为' + progess;
            //console.log('将项目进度由'+'${pro.progess}'+'更改为'+progess);
            var newMessage = document.getElementById("message").value = message;
            var form1 = document.getElementById("form1");
            form1.action = "updateProjectById";
            form1.submit();
        }

        $(window).on('load', function () {
            $('.selectpicker').selectpicker({
                'selectedText': 'cat'
            });
        });
    </script>
</head>
<body>
<h2>修改项目</h2>
<%--新的列表--%>
<form id="form1" method="post">
    <table class="table_xiugai">
        <tr>
            <td>序号</td>
            <td><input type="hidden" id="message" name="message"/>
                <input type="hidden" id="cid" name="id" value="${pro.id}"/>
                <input type="hidden" name="updateUser" value="${sessionScope.user.name}"/>
                <input id="xid" type="text" value="${pro.id}" disabled="disabled"/>
            </td>
            <td>项目组</td>
            <td>
                <select name="groups" id="groups">
                    <option>${pro.groups}</option>
                    <c:forEach items="${sessionScope.pGroups}" var="g">
                        <c:if test="${pro.groups!=g.paramValue}">
                            <option>${g.paramValue}</option>
                        </c:if>
                    </c:forEach>
                </select>

            </td>
        </tr>
        <tr>
            <td>项目进度</td>
            <td>
                <select name="progess" id="progess">
                    <option>${pro.progess}</option>
                    <c:forEach items="${sessionScope.progress}" var="p">
                        <c:if test="${pro.progess!=p.paramValue}">
                            <option>${p.paramValue}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </td>
            <td>备注说明1</td>
            <td><input type="text" name="remarks" id="remarks" value="${pro.remarks}"/></td>
        </tr>
        <tr>
            <td>项目类型</td>
            <td>
                <select name="wType" id="type">
                    <option>${pro.wType}</option>
                    <c:forEach items="${sessionScope.pType}" var="ty">
                        <c:if test="${pro.wType!=ty.paramValue}">
                            <option>${ty.paramValue}</option>
                        </c:if>
                    </c:forEach>
                </select>

            </td>
            <td>开始时间</td>
            <td><input type="date" name="sTime" id="stime" value="${pro.sTime}"/></td>
        </tr>
        <tr>
            <td>项目负责人</td>
            <td><%--<input type="text" name="leader" id="leader" value="${pro.leader}"/>--%>
                <select name="leader" id="leader">
                    <option>${pro.leader}</option>
                    <c:forEach items="${sessionScope.users}" var="user">
                        <c:if test="${pro.leader!=user.name}">
                            <option>${user.name}</option>
                        </c:if>
                    </c:forEach>
                </select>

            </td>
            <td>完成时间</td>
            <td><input type="date" name="eTime" id="etime" value="${pro.eTime}"/></td>
        </tr>
        <tr>
            <td>项目名称</td>
            <td>
              <%--  <input type="hidden" name="wName" id="cname" value="${pro.wName}"/>--%>
                <input type="text" id="cname" name="wName" value="${pro.wName}"/>
            </td>
            <td>订阅人</td>
            <td>
                <select id="others1" name="others1" class="selectpicker bla bla bli dropdown dropdown" multiple
                        data-live-search="true">
                    <optgroup label="">
                        <c:forEach items="${sessionScope.customerList}" var="c">
                            <option id="option" <c:if test="${fn:indexOf(requestScope.pro.others1,c.cname)!='-1'}">selected="selected"</c:if>>${c.cname}</option>
                        </c:forEach>
                    </optgroup>
                </select>
            </td>

        </tr>
        <tr>
            <td>客户负责人</td>
            <td>
               <%-- <input type="text" name="kehuer" id="kehuer" value="${pro.kehuer}"/>--%>
                   <select name="kehuer" id="kehuer">
                       <option>${pro.kehuer}</option>
                       <c:forEach items="${sessionScope.users}" var="user">
                           <c:if test="${pro.kehuer!=user.name}">
                               <option>${user.name}</option>
                           </c:if>
                       </c:forEach>
                   </select>
            </td>
            <td>审核人</td>
            <td><%--<input type="text" name="checker" id="checker" value="${pro.checker}"/>--%>
                <select name="checker" id="checker">
                    <option>${pro.checker}</option>
                    <c:forEach items="${sessionScope.users}" var="user">
                        <c:if test="${pro.checker!=user.name}">
                            <option>${user.name}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr class="update_tr">
            <%--<td>其他二</td>其他2不显示--%>
            <%--<td><input type="text" id="others2" name="others2"/></td>--%>
            <td class="update_bottom">项目情况</td>
            <td class="textarea"><textarea cols="30" name="pdetail" id="detail">${pro.pdetail}</textarea></td>
            <%--<td> <input type="text" name="others1" id="others1" value="${pro.others1}"/> </td>--%>
        </tr>
           <%-- <tr>
                <c:forEach var="c" items="${sessionScope.column}" varStatus="status">
                <c:if test="${status.index==0}"><tr></c:if>
                    <c:if test="${status.index%2==0}"></tr></c:if>
                    <td>${c.prop}</td>
                    <c:forEach var="cc" items="${proItems}" begin="${status.index}" end="${status.index}">
                        <td>
                            <input type="hidden" name="oldothersColumn" value="${cc.value}"/>
                            <input type="text" name="othersColumn" id="${cc.value}" value="${cc.value}"/>
                            <input type="hidden" name="pitemid" value="${cc.id}">
                            <input type="hidden" name="proitid" value="${cc.proitid}">
                        </td>
                    </c:forEach>
                </c:forEach>
            </tr>--%>
            <tr>
                <c:forEach var="cc" items="${historyItem}">
                    <td><input type="hidden" name="historyItem" value="${cc.proitid}"></td>
                </c:forEach>
            </tr>
        </table>
    <div class="update">
        <input class="tj" type="button" value="提交" onclick="updateById()"/>
        <a class="return" href="showAll">返回</a>
    </div>
</form>

</body>
</html>
